function p = subsasgn(p, S, V)
% BVQXprogress::subsref  - support for .Visible = assignments
%
% FORMAT:       pbar.Visible = VISFLAG;
%
% Input fields:
%
%       pbar        BVQXprogress object

% Version:  v0.8a
% Build:    9102320
% Date:     Oct-23 2009, 8:01 PM CEST
% Author:   Jochen Weber, SCAN Unit, Columbia University, NYC, NY, USA
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 2 || ...
    numel(p) ~= 1 || ...
   ~isstruct(S) || ...
   ~isfield(S, 'type') || ...
   ~isfield(S, 'subs') || ...
    isempty(S) || ...
   ~strcmp(S(1).type, '.')
    error( ...
        'BVQXprogress:BadCall', ...
        'Invalid call to BVQXprogress::subsasgn.' ...
    );
end

% what call
switch (lower(S(1).subs(:)'))
    case {'progress'}
        BVQXprogress(p, V);
    case {'visible'}
        BVQXprogress(p, 'setvisible', V);
    otherwise
        error( ...
            'BVQXprogress:BadCall', ...
            'Invalid call to BVQXprogress::subsasgn.' ...
        );
end
